package edu.westga.cs3202.sokoban;

/**
 * Controller tells the board when a move is requested and refreshes the panel.
 * 
 * @author Lewis Williams
 * @version 2011.2.17
 */
public class Controller {
	GameBoard board;
	GamePanel panel;
	
	/**
	 * Constructor for the controller that accepts a board and a panel.
	 * 
	 * @param board
	 * @param panel
	 */
    public Controller(GameBoard board, GamePanel panel) {
    	this.board = board;
    	this.panel = panel;
    }
    
    //Tells the board to attempt a move left and repaints the panel
    public void moveLeft(){
    	board.moveLeft();
    	panel.setPlayerGIF("images/pacmanleft.gif");
    	panel.refresh();
    }

    //Tells the board to attempt a move right and repaints the panel
	public void moveRight() {
		board.moveRight();
		panel.setPlayerGIF("images/pacmanright.gif");
    	panel.refresh();
	}

	//Tells the board to attempt a move up and repaints the panel
	public void moveUp() {
		board.moveUp();
		panel.setPlayerGIF("images/pacmanup.gif");
    	panel.refresh();
	}

	//Tells the board to attempt a move down and repaints the panel
	public void moveDown() {
		board.moveDown();
		panel.setPlayerGIF("images/pacmandown.gif");
    	panel.refresh();
	}


}